Skip to content

Concatenate/merge followups - #1316

Open
akx wants to merge 9 commits into
masterfrom
msgcat-msgmerge-followups
Open

akx wants to merge 9 commits into
masterfrom
msgcat-msgmerge-followups

Conversation

@akx

@akx akx commented Aug 13, 2026

Copy link
Copy Markdown
Member

Follows up on #1161 with some bugfixes and clarifications.

@akx akx added this to the Babel 2.19 milestone Aug 13, 2026
@akx

akx commented Aug 13, 2026

Copy link
Copy Markdown
Member Author

cc @soft-suroleb, please take a look :)

@codspeed

codspeed Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 88 untouched benchmarks


Comparing msgcat-msgmerge-followups (4200364) with master (853db81)

Open in CodSpeed

@codecov

codecov Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.75281% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.93%. Comparing base (853db81) to head (4200364).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
babel/messages/frontend.py 96.72% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1316      +/-   ##
==========================================
+ Coverage   93.62%   93.93%   +0.31%     
==========================================
  Files          27       27              
  Lines        4959     4966       +7     
==========================================
+ Hits         4643     4665      +22     
+ Misses        316      301      -15     
Flag Coverage Δ
macos-14-3.10 92.97% <97.75%> (+0.31%) ⬆️
macos-14-3.11 92.91% <97.75%> (+0.31%) ⬆️
macos-14-3.12 93.17% <97.75%> (+0.31%) ⬆️
macos-14-3.13 93.17% <97.75%> (+0.31%) ⬆️
macos-14-3.14 93.15% <97.75%> (+0.31%) ⬆️
macos-14-3.15 93.15% <97.75%> (+0.31%) ⬆️
macos-14-3.8 92.84% <97.75%> (+0.31%) ⬆️
macos-14-3.9 92.90% <97.75%> (+0.31%) ⬆️
macos-14-pypy3.10 92.97% <97.75%> (+0.31%) ⬆️
ubuntu-24.04-3.10 92.99% <97.75%> (+0.31%) ⬆️
ubuntu-24.04-3.11 92.93% <97.75%> (+0.31%) ⬆️
ubuntu-24.04-3.12 93.19% <97.75%> (+0.31%) ⬆️
ubuntu-24.04-3.13 93.19% <97.75%> (+0.31%) ⬆️
ubuntu-24.04-3.14 93.17% <97.75%> (+0.31%) ⬆️
ubuntu-24.04-3.15 93.17% <97.75%> (+0.31%) ⬆️
ubuntu-24.04-3.8 92.86% <97.75%> (+0.31%) ⬆️
ubuntu-24.04-3.9 92.92% <97.75%> (+0.31%) ⬆️
ubuntu-24.04-pypy3.10 92.99% <97.75%> (+0.31%) ⬆️
windows-2022-3.10 92.98% <97.75%> (+0.31%) ⬆️
windows-2022-3.11 92.92% <97.75%> (+0.31%) ⬆️
windows-2022-3.12 93.18% <97.75%> (+0.31%) ⬆️
windows-2022-3.13 93.18% <97.75%> (+0.31%) ⬆️
windows-2022-3.14 93.16% <97.75%> (+0.31%) ⬆️
windows-2022-3.15 93.16% <97.75%> (+0.31%) ⬆️
windows-2022-3.8 92.96% <97.75%> (+0.31%) ⬆️
windows-2022-3.9 92.92% <97.75%> (+0.31%) ⬆️
windows-2022-pypy3.10 92.98% <97.75%> (+0.31%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@akx
akx force-pushed the msgcat-msgmerge-followups branch from e924d32 to bf8af98 Compare August 14, 2026 06:13
@akx
akx force-pushed the msgcat-msgmerge-followups branch from bf8af98 to 72b41c7 Compare November 4, 2026 07:51
akx added 4 commits November 4, 2026 10:07
* Match compendium entries by context, and key the obsoleted translation replaced under --compendium-overwrite by context too.
* Keep a compendium entry's fuzzy flag instead of clearing it.
* Don't apply a compendium entry across pluralization.
* Recognize untranslated plural messages
* Skip untranslated compendium entries; they used to wipe out existing fuzzy translations.
@akx
akx force-pushed the msgcat-msgmerge-followups branch from 72b41c7 to 1201386 Compare November 4, 2026 08:28
@akx
akx force-pushed the msgcat-msgmerge-followups branch from 1201386 to 4200364 Compare November 4, 2026 08:33
@akx
akx requested a lite review from Copilot November 4, 2026 10:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

An active moderate defect in Catalog.setitem can discard an existing singular translation when upgrading to a plural entry, so the change is not yet safe to approve.

1 open issue
What changed in this PR

This pull request follows up on #1161 with fixes for PO catalog concatenation, compendium merging, conflict serialization, encoding, and legacy catalog compatibility.

Changes:

  • Improve handling of contextual, plural, untranslated, fuzzy, and conflicting messages.
  • Refine compendium matching and translation application.
  • Preserve catalog headers and support binary PO input.
  • Add regression coverage and compatibility handling for catalogs without conflict metadata.
  • Update coverage exclusions.
File Summary
tests/​messages/​utils.py Adds helpers for creating PO files and executing catalog commands.
tests/​messages/​test_pofile_write.py Tests writing catalogs without conflict metadata.
tests/​messages/​frontend/​test_merge.py Adds coverage for compendium matching, encoding, CLI behavior, and header handling.
tests/​messages/​frontend/​test_concat.py Adds coverage for contexts, plural conflicts, headers, translations, and fuzzy flags.
babel/​messages/​pofile.py Reworks conflict serialization while preserving plural and contextual data.
babel/​messages/​frontend.py Updates concatenation and compendium merge logic, including translation and header handling.
babel/​messages/​catalog.py Clones conflict messages and tolerates catalogs without conflict-tracking state.
.coveragerc Adjusts coverage exclusions for typing-only code and option-error paths.

Review effort: Lite

Comment on lines 1018 to +1021
catalog[message.id] = message
stored = catalog.get(message.id, message.context)

if translated and not was_translated and stored.pluralizable == message.pluralizable:
@akx
akx marked this pull request as ready for review November 4, 2026 14:13
@akx

akx commented Nov 4, 2026

Copy link
Copy Markdown
Member Author

ping @soft-suroleb :)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants